package com.hellojava.controller;

import com.hellojava.service.SysUserService;
import com.hellojava.util.WebUtil;
import com.hellojava.util.web.JsonResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author dengjihai
 * @create 2017-11-16
 **/
@RestController
@RequestMapping("/sysuser")
public class SysUserController {

    @Autowired
    SysUserService sysUserService;

    @GetMapping("/save/{name}/{pass}")
    public JsonResponse save(@PathVariable String name, @PathVariable String pass){
        sysUserService.save(name,pass);
        return WebUtil.successJsonResponse("操作成功");
    }

    @GetMapping("/list")
    public JsonResponse list(){
        return WebUtil.successJsonResponse("操作成功",sysUserService.getUserList());
    }

}
